//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------


#ifndef GUN_H
#define GUN_H


#include "Particle.h"
#include <vector>

using namespace std;


//-----------------------------------------------------------------------------
// shot description
//-----------------------------------------------------------------------------
struct SShot {

  float afPos[3];
  float afDir[3];
  float fLife;
  CParticle *poParticle;
  float fSpeed;
  float fDamage;
};


//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class CShotManager {

//-----------------------------------------------------------------------------
protected:

  vector<SShot> m_vstShot;

  int hits;
//-----------------------------------------------------------------------------
public:

  /// constructor
  CShotManager();

  /// destructor
  ~CShotManager();

  /// add a shot to the manager
  void AddShot(SShot stShot);

  ///
  void Update(float fDeltaTimeSeconds);

  /// draw
  void Draw();

  // enable light for shots
  void SetLights();

  int GetHits() {return hits;};

  void AddHit();
};


//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class CGun {

//-----------------------------------------------------------------------------
protected:

  /// particle
  CParticle *m_poParticle;

  float m_fSpeed;

  float m_fDamage;

  float m_fFireRate;

  int m_nAmmo;

//-----------------------------------------------------------------------------
public:

  /// constructor
  CGun();

  /// destructor
  ~CGun();

  /// Initialize the gun
  bool Init(const char *pszShotFilename, float fSpeed, float fDamage, float fFireRate);

  /// add ammo
  void AddAmmo(int nAmount);

  /// return a new shot
  SShot GetShot(float *pfPos, float *pfDir, float fLife);
};


#endif //GUN_H
